﻿using System;
using System.Collections.Generic;
using System.Text;

namespace QuestLib_TestCode
{
    using VOID = IEnumerator<QuestLib.ICondition>;

    public abstract class Quest : QuestLib.iQuest
    {
        public MyQuestPlayer _QuestPlayer;


        //static public abstract VOID OnNPCClick(uint wNPCIndex);

        

        public QuestLib.ICondition WaitSendDialog(string msg)
        {
            _QuestPlayer.Log("WaitSendDialog");

            return _QuestPlayer.SendDialog(msg);
        }

        protected QuestLib.ICondition WaitClickNpc(int id)
        {

            _QuestPlayer.Log("WaitClickNpc");

            //_QuestPlayer.Message("WaitClickNpc", id);
            return new Conditon_ClickNPC(id);
        }

        //protected QuestLib.ICondition HasFinishedQuest(uint questID)
        //{
        //    // 대충처리하고 
        //    _QuestPlayer.Message("HasFinishedQuest", questID);

        //    return new QuestLib.ICondition(QuestLib.EVENT.NONE, 0,1);
        //}
    
    }

    //public interface ICONTYPE
    //{

    //}

    enum CONTYPE
    {
        NPC_CLICK,
        DIALOG
    }

    public class Conditon_ClickNPC : QuestLib.ICondition
    {


        


        int _waitnpcID;

        public Conditon_ClickNPC(int waitnpcID)
        {
            _waitnpcID = waitnpcID;
        }


        public override bool _OnEvent(QuestLib.EvetArg eventID)
        {
            if (_waitnpcID == eventID._param)
                return true;
            return false;
        }

        public override int GetEventType()
        {
            return (int)CONTYPE.NPC_CLICK;
        }
    }


    public class Conditon_Dialog : QuestLib.ICondition
    {
        public Conditon_Dialog()
        {
            
        }

        public override bool _OnEvent(QuestLib.EvetArg eventID)
        {
            if (eventID._param == 1)
            {
                eventID._ret = 1;

            }
            else
            {
                eventID._ret = 0;
            }

            return true;
        }

        public override int GetEventType()
        {
            return (int)CONTYPE.DIALOG; ;
        }
    }


}
